﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<nelech.Models.DBModel.SearchAll>" %>

<%@ Import Namespace="nelech.Helpers" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    מפה אקטיבית - נלך
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h2>
        נלך- מפה אקטיבית</h2>
        <h3>
           מסלול- <img src="../../Content/Images/wazelogo1.png" />
           מקום- <img src="../../Content/Images/wazelogoPlace1.png" />
           מעיין- <img src="../../Content/Images/wazelogoSpring1.png" />
          אטרקציה-  <img src="../../Content/Images/wazelogoplace.png" />
            </h3>
    <div id="map" style="width: 600px; height: 800px">
    </div>
    <% 
        var renderPlace = nelech.Views.Shared.Code.Utils.GetEmbeddedString("nelech.Views.Shared.RenderPlaceOnWazeFunction.txt");

        Response.Write(renderPlace);
    %>
   
    <%
        Response.Write(
            "<script>" +
            "function onInit()" +
            "{\n" +
            "map = g_waze_map.map;\n" +
            "markers = new OpenLayers.Layer.Markers(\"Markers\");\n" +
            "map.addLayer(markers);\n"
            );

        foreach (var atr in Model.attractions)
        {

            var image = atr.Image.Count > 0 ? atr.Image.First().path : "";
            var smallImageName = System.IO.Path.GetFileName(image.Replace("\\", "/"));
           

            var popHtml = "<div class=\"popUpCloud\"  onclick=\"onPopupClose(null)\"><P class=\"close\">X</p><H1>" + Html.EncodeJavaScriptString(atr.title) + "</H1><img src=\"/Upload/Thumbs/" + smallImageName + "\" width=100><p><b>איזור:</b> " + Html.EncodeJavaScriptString(atr.Regeon.text) + "</p></p><b>קישור ישיר: </b><a href=\"/Attraction/AttractionInfo/" + atr.id + "\">" + Html.EncodeJavaScriptString(atr.title) + "</a></div>";
            Response.Write("setWazeMarker(" + atr.lon + "," + atr.lat + ",'" + Html.EncodeJavaScriptString(atr.title) + "','http://nelech.co.il/Content/Images/wazelogoplace.png', '" + popHtml + "');\n");
        }   
        foreach (var place in Model.places)
        {

            var image = place.Image.Count > 0 ? place.Image.First().path : "";
            var smallImageName = System.IO.Path.GetFileName(image.Replace("\\", "/"));
            var type = place.Type.Count > 0 ? place.Type.First().text : "";

            var popHtml = "<div class=\"popUpCloud\"  onclick=\"onPopupClose(null)\"><P class=\"close\">X</p><H1>" + Html.EncodeJavaScriptString(place.name) + "</H1><img src=\"/Upload/Thumbs/" + smallImageName + "\" width=100><p><b>איזור:</b> " + Html.EncodeJavaScriptString(place.Regeon1.text) + " <b>סוג:</b>" + Html.EncodeJavaScriptString(type) + "</p><p><b>תקציר:</b>" + Html.EncodeJavaScriptString(place.summary) + "</p><b>קישור ישיר: </b><a href=\"/Place/PlaceInfo/" + place.id + "\">" + Html.EncodeJavaScriptString(place.name) + "</a></div>";
            Response.Write("setWazeMarker(" + place.lon + "," + place.lat + ",'" + Html.EncodeJavaScriptString(place.name) + "','http://nelech.co.il/Content/Images/wazelogoPlace1.png', '" + popHtml + "');\n");
        }
        foreach (var track in Model.tracks)
        {

            var image = track.Image.Count > 0 ? track.Image.First().path : "";

            var smallImageName = System.IO.Path.GetFileName(image.Replace("\\", "/"));
            var popHtml = "<div class=\"popUpCloud\"  onclick=\"onPopupClose(null)\"><P class=\"close\">X</p><H1>" + Html.EncodeJavaScriptString(track.title) + "</H1><img src=\"/Upload/Thumbs/" + smallImageName + "\" width=100><p><b>רמת קושי:</b> " + Html.EncodeJavaScriptString(track.Difficulty1.text) + " <b>משך:</b>" + Html.EncodeJavaScriptString(track.Duration1.text) + "<b>בתשלום:</b> " + Html.EncodeJavaScriptString(track.Cost1.text) + "</p><p><b>תקציר:</b>" + Html.EncodeJavaScriptString(track.summary) + "</p><b>קישור ישיר: </b><a href=\"/Track/TrackInfo/" + track.number + "\">" + Html.EncodeJavaScriptString(track.title) + "</a></div>";
            Response.Write("setWazeMarker(" + track.lon + "," + track.lat + ",'" + Html.EncodeJavaScriptString(track.title) + "','http://nelech.co.il/Content/Images/wazelogo1.png', '" + popHtml + "');\n");
        }
        foreach (var spring in Model.springs)
        {
            var image = spring.Image.Count > 0 ? spring.Image.First().path : "";

            var smallImageName = System.IO.Path.GetFileName(image.Replace("\\", "/"));

            var popHtml = "<div class=\"popUpCloud\"  onclick=\"onPopupClose(null)\"><P class=\"close\">X</p><H1>" + Html.EncodeJavaScriptString(spring.name) + "</H1><src=\"/Upload/Thumbs/" + smallImageName + "\" width=100><p><b>איזור:</b> " + Html.EncodeJavaScriptString(spring.Regeon1.text) + " <b>בתשלום:</b>" + Html.EncodeJavaScriptString(spring.Cost1.text) + "</p><p><b>תקציר:</b>" + Html.EncodeJavaScriptString(spring.summary) + "</p><b>קישור ישיר: </b><a href=\"/Place/SpringInfo/" + spring.id + "\">" + Html.EncodeJavaScriptString(spring.name) + "</a></div>";

            Response.Write("setWazeMarker(" + spring.lon + "," + spring.lat + ",'" + Html.EncodeJavaScriptString(spring.name) + "','http://nelech.co.il/Content/Images/wazelogoSpring1.png', '" + popHtml + "');\n");
        }
            
    %>
    }
    </script>
    <%
        var wazeBody = nelech.Views.Shared.Code.Utils.GetEmbeddedString("nelech.Views.Shared.WazeBodyMain.txt");

        Response.Write(wazeBody);
    %>
    <p>
        המפה באדיבות WAZE - קהילת הנהגים של ישראל (ראה <a href="http://waze.co.il">waze.co.il</a>)</p>
    <!-- _DEBUG_INC_ -->

    <script type="text/javascript" src="http://www.waze.co.il/js/OpenLayers.js"> </script>

    <!-- _DEBUG_INC_ -->

    <script type="text/javascript" src="http://www.waze.co.il/js/jquery.js"></script>

    <!-- _DEBUG_INC_ -->

    <script type="text/javascript" src="http://www.waze.co.il/js/mapnik.js"></script>

    <!-- _DEBUG_INC_ -->

    <script type="text/javascript" src="http://www.waze.co.il/js/WazePanZoomBar.js"></script>

    <script type="text/javascript" src="http://www.waze.co.il/js/WazeEmbeddedMap.js"></script>

</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="publishTop" runat="server">
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="Right" runat="server">
</asp:Content>
